import { request } from '../utils/request';
import { apiVirtualSuccessAccess, useVirtualAccess } from '../utils/tools';

export async function queryListData(params) {
  if (useVirtualAccess()) {
    const result = await apiVirtualSuccessAccess({
      pagesize: 10,
      total: 645,
      nowpageindex: 1,
      data: [
        {
          rowId: 1,
          intcityid: 152,
          intproductid: 573,
          intrankid: 8,
          intbrandid: 0,
          chvno: 'KNBB',
          intbuytype: 1,
          chvtitle: '康妮宝贝V9纸巾手提箱',
          chvspec: '60抽×24包/箱',
          intsaletype: 1,
          chvsubtitle: '',
          chvdescription:
            '原生木浆，不添加任何荧光济，通过SGS零刺激认证，通过美国FDA食品极检测，通过欧盟EU食品极检测，康妮宝贝婴儿纸巾，保湿纸巾新生儿干湿两用面巾，特惠85元/箱',
          chvkeywords: '康妮宝贝·婴儿纸巾·欧盟品质，特惠85元',
          moncostprice: 70.0,
          monstockprice: 78.0,
          monmarketprice: 118.0,
          monsaleprice: 85.0,
          monexpressprice: 1.0,
          intstate: 1,
          dtmintime: '2018-11-06T10:06:12.757',
          intRecommend: 0,
          intNew: 0,
          intGift: 0,
        },
        {
          rowId: 2,
          intcityid: 152,
          intproductid: 34,
          intrankid: 2,
          intbrandid: 0,
          chvno: 'NJ-801',
          intbuytype: 1,
          chvtitle: '黄河滩散养柴鸡蛋',
          chvspec: '10斤/箱',
          intsaletype: 1,
          chvsubtitle: '富含碘和维生素B2，饱和脂肪含量比普通鸡蛋低25％',
          chvdescription:
            '细心的妈妈，越来越偏爱于真正散养的土鸡蛋。土鸡蛋富含碘和维生素B2，饱和脂肪含量比普通鸡蛋低25％',
          chvkeywords: '黄河滩散养柴鸡蛋，以青草和虫子为食-售价65元',
          moncostprice: 54.0,
          monstockprice: 59.5,
          monmarketprice: 110.0,
          monsaleprice: 65.0,
          monexpressprice: 7.0,
          intstate: 0,
          dtmintime: '2018-11-06T09:49:57.447',
          intRecommend: 0,
          intNew: 0,
          intGift: 0,
        },
        {
          rowId: 3,
          intcityid: 152,
          intproductid: 638,
          intrankid: 2,
          intbrandid: 0,
          chvno: 'XSD01',
          intbuytype: 1,
          chvtitle: '兴盛德黑芝麻片',
          chvspec: '350克',
          intsaletype: 1,
          chvsubtitle: '',
          chvdescription:
            '纯手工制作黑芝麻片，松脆爽口，不是很甜，吃起来满满的香， 香甜口味暖暖在心里，至今还是老少皆宜的健康食品',
          chvkeywords: '手工制作·黑芝麻片·弄弄芝麻香·老少皆宜11.5元',
          moncostprice: 8.5,
          monstockprice: 9.8,
          monmarketprice: 16.0,
          monsaleprice: 11.5,
          monexpressprice: 0.0,
          intstate: 0,
          dtmintime: '2018-11-06T09:41:31.07',
          intRecommend: 0,
          intNew: 0,
          intGift: 0,
        },
        {
          rowId: 4,
          intcityid: 152,
          intproductid: 648,
          intrankid: 6,
          intbrandid: 0,
          chvno: 'ZD-02',
          intbuytype: 1,
          chvtitle: '正大椒香酥肉',
          chvspec: '',
          intsaletype: 1,
          chvsubtitle: '',
          chvdescription: '',
          chvkeywords: '',
          moncostprice: 1.0,
          monstockprice: 1.0,
          monmarketprice: 1.0,
          monsaleprice: 1.0,
          monexpressprice: 1.0,
          intstate: 1,
          dtmintime: '2018-11-06T09:37:08.82',
          intRecommend: 0,
          intNew: 0,
          intGift: 0,
        },
        {
          rowId: 5,
          intcityid: 152,
          intproductid: 390,
          intrankid: 10,
          intbrandid: 0,
          chvno: 'SYBP-001',
          intbuytype: 1,
          chvtitle: '山药薄片',
          chvspec: '3袋装',
          intsaletype: 1,
          chvsubtitle: '',
          chvdescription:
            '即食锅巴特产零食小吃脆薯片薄片，三种口味番茄、酱香、卤香。片型纤薄，轻脆上口！',
          chvkeywords: '网红零食山药薄片,三个口味一起来。讲真，吃完还想舔手指!',
          moncostprice: 5.5,
          monstockprice: 7.4,
          monmarketprice: 17.8,
          monsaleprice: 9.9,
          monexpressprice: 1.0,
          intstate: 1,
          dtmintime: '2018-11-06T08:58:17.273',
          intRecommend: 0,
          intNew: 0,
          intGift: 0,
        },
        {
          rowId: 6,
          intcityid: 152,
          intproductid: 107,
          intrankid: 1,
          intbrandid: 0,
          chvno: 'TGLY',
          intbuytype: 1,
          chvtitle: '桂圆',
          chvspec: '2斤装',
          intsaletype: 1,
          chvsubtitle: '',
          chvdescription:
            '果肉香甜，瓤肉厚而嫩脆，味道甘甜而清香，真是“香露滴芳鲜”核则是圆溜溜的，表面光滑，呈红黑色。',
          chvkeywords: '泰国小核桂圆·皮薄肉厚·清香直甜，特惠19.8元',
          moncostprice: 16.8,
          monstockprice: 18.0,
          monmarketprice: 28.0,
          monsaleprice: 19.8,
          monexpressprice: 1.0,
          intstate: 1,
          dtmintime: '2018-11-06T08:14:53.15',
          intRecommend: 0,
          intNew: 0,
          intGift: 0,
        },
        {
          rowId: 7,
          intcityid: 152,
          intproductid: 285,
          intrankid: 1,
          intbrandid: 0,
          chvno: 'SM-1',
          intbuytype: 1,
          chvtitle: '树莓',
          chvspec: '125g/盒',
          intsaletype: 1,
          chvsubtitle: '果型娇小，绵软果肉，中空无核，轻嚼柔嫩芳香，口口过瘾',
          chvdescription: '果型娇小，绵软果肉，中空无核，轻嚼柔嫩，慢慢品味一口口芳香。',
          chvkeywords: '红的娇艳，红的诱惑，源于山间的美味-树莓，仅售16.8元',
          moncostprice: 10.5,
          monstockprice: 14.0,
          monmarketprice: 26.0,
          monsaleprice: 16.8,
          monexpressprice: 3.0,
          intstate: 1,
          dtmintime: '2018-11-06T08:14:53.15',
          intRecommend: 0,
          intNew: 0,
          intGift: 0,
        },
        {
          rowId: 8,
          intcityid: 152,
          intproductid: 614,
          intrankid: 5,
          intbrandid: 0,
          chvno: 'SGLM',
          intbuytype: 1,
          chvtitle: '手工烙馍',
          chvspec: '10张/包',
          intsaletype: 1,
          chvsubtitle: '',
          chvdescription: '纯手工烙馍，当天现烙现发，口感劲道有嚼劲，您最佳的早餐解决方案之一！',
          chvkeywords: '纯手工烙馍·面香十足·口感劲道，特惠5.8元',
          moncostprice: 2.8,
          monstockprice: 4.0,
          monmarketprice: 10.0,
          monsaleprice: 5.8,
          monexpressprice: 1.0,
          intstate: 0,
          dtmintime: '2018-11-06T06:35:05.413',
          intRecommend: 0,
          intNew: 0,
          intGift: 0,
        },
        {
          rowId: 9,
          intcityid: 152,
          intproductid: 362,
          intrankid: 3,
          intbrandid: 0,
          chvno: 'MGSN-02',
          intbuytype: 1,
          chvtitle: '裸的 蒙古熟酸奶',
          chvspec: '180g×14袋',
          intsaletype: 1,
          chvsubtitle: '',
          chvdescription:
            '好奶源，好品质，生牛乳低温发酵，最简单的包装，还原最初的味道，每餐一杯雪原裸的熟酸奶，品尝源于内蒙乌兰察布的味道！生产日期10月24号',
          chvkeywords: '裸的酸奶·零色素·零香精，活动价21.8元',
          moncostprice: 19.0,
          monstockprice: 20.3,
          monmarketprice: 35.0,
          monsaleprice: 21.8,
          monexpressprice: 1.0,
          intstate: 1,
          dtmintime: '2018-11-06T06:34:20.993',
          intRecommend: 0,
          intNew: 0,
          intGift: 0,
        },
        {
          rowId: 10,
          intcityid: 152,
          intproductid: 541,
          intrankid: 11,
          intbrandid: 0,
          chvno: 'JZG-01',
          intbuytype: 1,
          chvtitle: '金针菇',
          chvspec: '0.8斤x2包',
          intsaletype: 1,
          chvsubtitle: '',
          chvdescription: '剁椒金针菇，凉拌金针菇，香辣金针菇，金针菇炒蛋... 每一种吃法都诱惑难挡',
          chvkeywords: '新鲜金针菇，口感鲜美，营养丰富，2包仅售6.9元',
          moncostprice: 5.0,
          monstockprice: 6.0,
          monmarketprice: 11.0,
          monsaleprice: 6.9,
          monexpressprice: 0.0,
          intstate: 1,
          dtmintime: '2018-11-06T06:33:56.587',
          intRecommend: 0,
          intNew: 0,
          intGift: 0,
        },
      ],
    });

    return result;
  }

  return request('/Product/GetProductList', {
    method: 'POST',
    body: params,
  });
}

export async function queryGetData(params) {
  if (useVirtualAccess()) {
    const result = await apiVirtualSuccessAccess({
      data: {
        intProductID: 21,
        intCityID: 152,
        intRankID: 2,
        intBrandID: 0,
        chvMd5: 'a0b5e242be33e73e',
        chvNo: 'NJ-003',
        chvTitle: '跑步童子鸡',
        chvSubTitle: '',
        chvHabitat: null,
        chvDescription:
          '中秋过节，少不了 山区散养跑步鸡，肉质紧致，味道特别好，香喷喷的也不腥，和小时候喝的鸡汤一个味。节日特惠，每只欢再送芝麻叶一包。',
        chvKeywords: '【周五配送】回味小时候·山区散养·昆虫为食，尝鲜78元/只',
        chvMainImageUrl: '/Upload/310433533.jpg',
        MonCostPrice: 60.0,
        MonStockPrice: 68.0,
        MonSalePrice: 78.0,
        MonMarketPrice: 108.0,
        MonExpressPrice: 5.0,
        chvContent:
          '再次提醒朋友们，一定要提前下单，第二天冰鲜配送，推广期一只仅售85元，包括整只鸡以及鸡内脏，卫生请您放一百个心，我们在郑州做事情，会用心保证每一个定单的质量。【特别提示】新鲜的土鸡，请在收到货冷藏保鲜（1天）或冷冻保鲜（3天），并尽快食用，如果超过3天，鲜度就会下降。',
        intVisitCount: 10995,
        intSort: 999,
        intSaleCount: 710,
        intScore: 0,
        intIsRecommend: 0,
        chvGuaranteePeriod: null,
        intStoreCount: 67,
        intIsChildType: null,
        chvDisCount: null,
        intState: 1,
        intIsHot: 0,
        dtmProduction: null,
        dtmInTime: '2018-11-14T16:28:51.273',
        chvBelongCity: null,
        intSaleType: 1,
        monStorePrice: 78.0,
        chvUnit: '箱',
        chvSpec: '屠宰后约2.2斤',
        intProductType: 1,
        dtmEndTime: null,
        monReturnPrice: 1.0,
        dtmUpdateTime: '2018-10-31T16:11:06.72',
        intIsSku: 0,
        intBuyType: 2,
        intIsGift: 0,
        intMoreNum: 0,
      },
    });

    return result;
  }

  return request('/Product/GetProductInfo', {
    method: 'POST',
    body: params,
  });
}

export async function addData(params) {
  return request('/api/Product/Add', {
    method: 'POST',
    body: params,
  });
}

export async function updateBasicData(params) {
  if (useVirtualAccess()) {
    const result = await apiVirtualSuccessAccess({
      data: {},
    });

    return result;
  }
  return request('/api/Product/UpdateBasic', {
    method: 'POST',
    body: params,
  });
}

export async function updateContentData(params) {
  if (useVirtualAccess()) {
    const result = await apiVirtualSuccessAccess({
      data: {},
    });

    return result;
  }

  return request('/api/Product/updateContent', {
    method: 'POST',
    body: params,
  });
}

export async function setRecommend(params) {
  if (useVirtualAccess()) {
    const result = await apiVirtualSuccessAccess({
      data: {},
    });

    return result;
  }

  return request('/api/Product/SetRecommend', {
    method: 'POST',
    body: params,
  });
}

export async function setNew(params) {
  if (useVirtualAccess()) {
    const result = await apiVirtualSuccessAccess({
      data: {},
    });

    return result;
  }

  return request('/api/Product/SetNew', {
    method: 'POST',
    body: params,
  });
}

export async function setGift(params) {
  if (useVirtualAccess()) {
    const result = await apiVirtualSuccessAccess({
      data: {},
    });

    return result;
  }

  return request('/api/Product/SetGift', {
    method: 'POST',
    body: params,
  });
}

export async function removeData(params) {
  return request('/api/Product/Remove', {
    method: 'POST',
    body: params,
  });
}

/**
 * 占位函数
 *
 * @export
 * @returns
 */
export async function empty() {
  return {};
}
